package com.xjoyt.pay.share.po;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;

/**
 * 文件对象
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_file_object")
public class FileObejct {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "file_object_id", length = 36)
	public String id;

	/**
	 * 通道
	 */
	@OneToOne(targetEntity = Bucket.class, cascade = {})
	@JoinColumn(name = "bucket_id", foreignKey = @ForeignKey(name = "none"))
	public Bucket bucket;

	/**
	 * 外键
	 */
	@Column(name = "`key`", length = 36)
	public String key;

	/**
	 * 属性
	 */
	@Column(name = "property", length = 36)
	public String property;

	/**
	 * 添加日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

	/**
	 * 备注
	 */
	@Column(name = "remark", length = 255)
	public String remark;

	/**
	 * 路径
	 */
	@Column(name = "`path`", length = 255)
	public String path;

	/**
	 * 文件名
	 */
	@Column(name = "`name`", length = 50)
	public String name;

	/**
	 * 文件类型
	 */
	@Column(name = "contentType", length = 50)
	public String contentType;
}
